package n1860;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	static int max=101;
	static double eps=1e-7;
	static double rate[][]=new double[max][max];
	static double com[][]=new double[max][max];
	static double value[]=new double[max];
	static int N,M,S;
	static double V;
	static boolean solve()
	{
		for(int i=0;i<=N;i++)value[i]=0;
		value[S]=V;
		for(int k=0;k<N-1;k++)
		{
			boolean relax=false;
			for(int i=1;i<=N;i++)
				for(int j=1;j<=N;j++)
				{
					if(i!=j&&rate[i][j]>eps&&value[j]<(value[i]-com[i][j])*rate[i][j])
					{
						value[j]=(value[i]-com[i][j])*rate[i][j];
						relax=true;
					}
				}
			if(relax==false)return false;
		}
		
		for(int i=1;i<=N;i++)
			for(int j=1;j<=N;j++)
			{
				if(i!=j&&rate[i][j]>eps&&value[j]<(value[i]-com[i][j])*rate[i][j])
				{
					return true;
				}
			}
		return false;
	}
	
	
	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub

		BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
		String line=bf.readLine();
		StringTokenizer st=new StringTokenizer(line);
		N=Integer.parseInt(st.nextToken());
		M=Integer.parseInt(st.nextToken());
		S=Integer.parseInt(st.nextToken());
		V=Double.parseDouble(st.nextToken());
		for(int i=0;i<M;i++)
		{
			line=bf.readLine();
			st=new StringTokenizer(line);
			int na=Integer.parseInt(st.nextToken());
			int nb=Integer.parseInt(st.nextToken());
			rate[na][nb]=Double.parseDouble(st.nextToken());
			com[na][nb]=Double.parseDouble(st.nextToken());
			rate[nb][na]=Double.parseDouble(st.nextToken());
			com[nb][na]=Double.parseDouble(st.nextToken());
		}
		if(solve()) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
		
	}

}
